import { post } from '@/api/http';
import { defineStore } from 'pinia'

export const useProductionManagementStore = defineStore('production-management', {
    state: () => {
        return {
            total: 0,
            page: 1,
            size: 10,
            table: {
                dataList: []
            } as any,
            selectedRowKeys: [] as any,
            rowKey: 'id',
            tableColumns: [
                {
                    title: "公司",
                    key: "firm",
                    dataIndex: "firm",
                    width: 150
                },
                {
                    title: "织布单号",
                    key: "planOrderCode",
                    dataIndex: "planOrderCode",
                    width: 150
                },
                {
                    title: "生产单号",
                    key: "weaveCode",
                    dataIndex: "weaveCode",
                    width: 150
                },
                {
                    title: "客户名称",
                    key: "customName",
                    dataIndex: "customName",
                    width: 200
                },
                {
                    title: "客户订单号",
                    key: "customOrderNo",
                    dataIndex: "customOrderNo",
                    width: 150
                },
                {
                    title: "条形码",
                    key: "clothfiyCode",
                    dataIndex: "clothfiyCode",
                    width: 200
                },
                {
                    title: "机台号",
                    key: "machineCode",
                    dataIndex: "machineCode",
                    width: 200
                },
                {
                    title: "楼层",
                    key: "storey",
                    dataIndex: "storey",
                    width: 200
                },
                {
                    title: "机型",
                    key: "machineType",
                    dataIndex: "machineType",
                    width: 200
                },
                {
                    title: "针寸数",
                    key: "workDrum",
                    dataIndex: "workDrum",
                    width: 200
                },
                {
                    title: "匹号",
                    key: "horses",
                    dataIndex: "horses",
                    width: 200
                },
                {
                    title: "机布号",
                    key: "machineGreyCode",
                    dataIndex: "machineGreyCode",
                    width: 200
                },
                {
                    title: "坯布编号",
                    key: "greyCode",
                    dataIndex: "greyCode",
                    width: 200
                },
                {
                    title: "坯布名称",
                    key: "greyName",
                    dataIndex: "greyName",
                    width: 200
                },
                {
                    title: "坯布批号",
                    key: "greyBatchNo",
                    dataIndex: "greyBatchNo",
                    width: 200
                },
                {
                    title: "等级",
                    key: "level",
                    dataIndex: "level",
                    width: 200
                },
                {
                    title: "颜色",
                    key: "color",
                    dataIndex: "color",
                    width: 200
                },
                {
                    title: "值机班组",
                    key: "departmentByDuty",
                    dataIndex: "departmentByDuty",
                    width: 200
                },
                {
                    title: "值机员",
                    key: "empNameByDuty",
                    dataIndex: "empNameByDuty",
                    width: 200
                },
                {
                    title: "值机转数",
                    key: "joinConvolution",
                    dataIndex: "",
                    width: 200
                },
                {
                    title: "落布重量",
                    key: "croppingWeight",
                    dataIndex: "croppingWeight",
                    width: 200
                },
                {
                    title: "个人磅布重量",
                    key:"actualWeight",
                    dataIndex:"actualWeight",
                    width: 200
                },
                {
                    title: "个人理论重量",
                    key: "weightByEmp",
                    dataIndex: "weightByEmp",
                    width: 200
                },
                {
                    title: "个人验后重量",
                    key: "posteriorWeightByEmp",
                    dataIndex: "posteriorWeightByEmp",
                    width: 200
                },
                {
                    title: "个人次布重量",
                    key: "fabricWeightByEmp",
                    dataIndex: "fabricWeightByEmp",
                    width: 200
                },
                {
                    title: "次布转数",
                    key: "fabricNun",
                    dataIndex: "fabricNun",
                    width: 200
                },
                {
                    title: "扣米数",
                    key: "buttonMeterNum",
                    dataIndex: "buttonMeterNum",
                    width: 200
                },
                {
                    title: "验布班组",
                    key: "departmentByCheck",
                    dataIndex: "departmentByCheck",
                    width: 200
                },
                {
                    title: "验布1",
                    key: "empNameByCheck1",
                    dataIndex: "empNameByCheck1",
                    width: 200
                },
                {
                    title: "验布2",
                    key: "empNameByCheck2",
                    dataIndex: "empNameByCheck2",
                    width: 200
                },
                {
                    title: "个人疵点信息",
                    key: "defectInfo",
                    dataIndex: "defectInfo",
                    width: 200
                },
                {
                    title: "开剪疵点",
                    key: "cutDefectInfo",
                    dataIndex: "cutDefectInfo",
                    width: 200
                },
                {
                    title: "备注",
                    key: "remark",
                    dataIndex: "remark",
                    width: 200
                },
                {
                    title: "落布日期",
                    key: "dateByClothScan",
                    dataIndex: "dateByClothScan",
                    width: 200
                },
                {
                    title: "初检日期",
                    key: "dateByCheckFirst",
                    dataIndex: "dateByCheckFirst",
                    width: 200
                },
                {
                    title: "复核日期",
                    key: "dateByCheckAfter",
                    dataIndex: "dateByCheckAfter",
                    width: 200
                },
                {
                    title: "最后检验时间",
                    key: "lastCheckDate",
                    dataIndex: "lastCheckDate",
                    width: 200
                },
            ] as any,
            pageData: {
                planOrderCode: '',
                customName: '',
                clothName: '',
                dateByClothScan: '',
                startDateByDuty: '',
                endDateByDuty: '',
                nameList: [],
                showAdd: false,
                sideTitle: '新增产品基础资料',
                dropDownData: "",
                pageLoading: false,
                tablediv: null,
                rHeight: "",
                btnList: [],
                isEdit: false,
                firmId:null,
                areaList:[],
                deptList:[],
                fistSgcTime:[]
            } as any,
            //底部合计行
        };
    },
    actions: {
        selectBd() {
            return post({
                url: "qms/report/getPageCheckInDetail",
                data: {
                    page:this.page,
                    size: this.size,
                    // deleteState: 0,
                    planOrderCode: this.pageData.planOrderCode,
                    customName: this.pageData.customName,
                    clothName: this.pageData.clothName,
                    startDateByDuty: this.pageData.startDateByDuty,
                    endDateByDuty: this.pageData.endDateByDuty,
                    storey: this.pageData.storey,
                    departmentByDutyId: this.pageData.departmentByDuty,
                    dateByCheckFirstStart: this.pageData.fistSgcTime ? this.pageData.fistSgcTime[0] :'',
                    dateByCheckFirstEnd: this.pageData.fistSgcTime ? this.pageData.fistSgcTime[1]:''
                    // productTypeName: this.pageData.dropDownData
                }
            })
        },
    },
})